   import { Injectable } from '@nestjs/common';
   import * as puppeteer from 'puppeteer';

   @Injectable()
   export class PdfService {
     async generatePdf(html: string, filename: string): Promise<Buffer> {
       const browser = await puppeteer.launch();
       const page = await browser.newPage();

       await page.setContent(html);
       const pdfBuffer = await page.pdf({ path: filename, format: 'A4' });

       await browser.close();

       return pdfBuffer;
     }
   }